﻿<baseview:BaseView x:Class="CharacterCreation.Views.SkillDetailView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:baseview="clr-namespace:CharacterCreation.Views.Contracts" 
    xmlns:controls="clr-namespace:CharacterCreation.Controls"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot">
        <Grid.Resources>
            <Style TargetType="TextBlock">
                <Setter Property="Foreground" Value="{Binding ForegroundBrush}" />
                <Setter Property="Margin" Value="5" />
                <Setter Property="VerticalAlignment" Value="Center" />
            </Style>
            <Style TargetType="TextBox">
                <Setter Property="Margin" Value="5" />
                <Setter Property="VerticalAlignment" Value="Top" />
            </Style>

            <SolidColorBrush x:Key="foregroundBrush" Color="{Binding ForegroundBrush}" />
        </Grid.Resources>


        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="2*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="53*" />
        </Grid.RowDefinitions>

        <TextBlock Text="Name:" Grid.Column="0" Grid.Row="0" />
        <TextBox Text="{Binding Skill.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Height="24"
                 Grid.Column="1" Grid.Row="0"/>

        <TextBlock Text="Description: " Grid.Column="0" Grid.Row="1" />
        <TextBox Text="{Binding Skill.Description, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Height="75"
                 Grid.Column="1" Grid.Row="1" AcceptsReturn="True" TextWrapping="Wrap" />

        <TextBlock Grid.Row="2" Text="XP Cost:" Grid.Column="0" />
        <TextBox Grid.Column="1" Grid.Row="2"  Height="24" VerticalAlignment="Center" 
                 Text="{Binding Skill.XPCost, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

        <TextBlock Text="Priority point cost:" Grid.Row="3" VerticalAlignment="Center" />
        <TextBox Grid.Column="1" Grid.Row="3"  Height="24" 
                 Text="{Binding Skill.PriorityPointCost, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

        <Grid Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="4">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*" />
                <ColumnDefinition Width="2*" />
            </Grid.ColumnDefinitions>

            <controls:ListBox Grid.Column="0" ItemsSource="{Binding statistics}" Width="120" >
                <controls:ListBox.CustomItemTemplate>
                    <DataTemplate>
                        <Border Height="30" BorderBrush="{StaticResource backgroundBrush}" BorderThickness="1" CornerRadius="3" Margin="2" Padding="2" Background="White">
                            <TextBlock Text="{Binding}" Foreground="Black" VerticalAlignment="Center" HorizontalAlignment="Center" />
                        </Border>
                    </DataTemplate>
                </controls:ListBox.CustomItemTemplate>

                <controls:ListBox.SelectedItemTemplate>
                    <DataTemplate>
                        <Border Height="30" BorderBrush="{StaticResource backgroundBrush}" BorderThickness="1" CornerRadius="3" Margin="2" Padding="2" Background="White">
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                <TextBlock Text="{Binding}" VerticalAlignment="Center" />
                                <Button Style="{StaticResource actionButton}" 
                                        Command="{Binding ElementName=LayoutRoot, Path=DataContext.AddStatisticCommand}"
                                        CommandParameter="{Binding}">
                                    <Image Height="16" Width="16" Source="/Images/ctron_add_26.png" />
                                </Button>
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </controls:ListBox.SelectedItemTemplate>
            </controls:ListBox>

            <controls:ListBox Grid.Column="1" ItemsSource="{Binding Skill.Statistics}" >
                <controls:ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel />
                    </ItemsPanelTemplate>
                </controls:ListBox.ItemsPanel>
                
                <controls:ListBox.CustomItemTemplate>
                    <DataTemplate>
                        <Border Height="30" BorderBrush="{StaticResource backgroundBrush}" BorderThickness="1" CornerRadius="3" Margin="2" Padding="2" Background="White" Width="120">
                            <TextBlock Text="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Center" />
                        </Border>
                    </DataTemplate>
                </controls:ListBox.CustomItemTemplate>

                <controls:ListBox.SelectedItemTemplate>
                    <DataTemplate>
                        <Border Height="30" BorderBrush="{StaticResource backgroundBrush}" BorderThickness="1" CornerRadius="3" Margin="2" Padding="2" Background="White" Width="120" >
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                <TextBlock Text="{Binding}" Foreground="Black" VerticalAlignment="Center" />
                                <Button Style="{StaticResource actionButton}"
                                        Command="{Binding ElementName=LayoutRoot, Path=DataContext.RemoveStatisticCommand}"
                                        CommandParameter="{Binding}">
                                    <Image Height="16" Width="16" Source="/Images/ctron_delete_26.png" />
                                </Button>
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </controls:ListBox.SelectedItemTemplate>
            </controls:ListBox>
        </Grid>
    </Grid>
</baseview:BaseView>
